package concurrent;

import java.util.concurrent.BlockingQueue;;

public class Producer implements Runnable{

	private final String producerName;
	private final BlockingQueue<String> queue;
	
	Producer(String producerName, BlockingQueue<String> queue){
		this.producerName = producerName;
		this.queue = queue;
	}
	
	public void run(){
		for(int i = 0; i < 10; i++){
			try{
				System.out.println("Input is: "+producerName+":"+i);
				queue.put(producerName+":"+i);
			}catch(InterruptedException ex){
				ex.printStackTrace();
			}	
			
		}
	}
	
	
	
}
